import re
import urllib.request
# urllib2在python3.x中被改为urllib.request



def getHtml(url):
    res = urllib.request
    page = res.urlopen(url)
    html = page.read()
    return html

def getImg(html):
    reg = r'src="(.+?\.jpg)" pic_ext'
    imgre = re.compile(reg)
    imglist = re.findall(imgre, html)
    return imglist


html = getHtml("http://tieba.baidu.com")
print(getImg(html))
